import Vue from 'vue'
import Router from 'vue-router'
// import Router只是一个别名 from才是包的功能
// 在'vue-router' 文件，export default {功能} 抛出功能，才能引入
import ShowCenter from '@/components/ShowCenter'
import Base from '@/components/Base'
import Login from '@/components/Login'
import Host from '@/components/Host'
import Console from '@/components/Console'
import MultiExec from '@/components/MultiExec'
import Environment from '@/components/Environment'
import Release from '@/components/Release'
import ReleaseApply from '@/components/ReleaseApply'
import ReleaseResult from '@/components/ReleaseResult'
import Schedule from '@/components/Schedule'

Vue.use(Router)

export default new Router({
  mode: 'history',  // 路径中去#号
  routes: [
    {
      path: '/',
      component: Login
    },
    {
      path: '/hippo',
      component: Base,
      children: [
        {
          path: 'host/',  //访问路径 hippo/host/
          component: Host
        },
        { path: 'showcenter/', component: ShowCenter },
        {
          // 通过this.route.params.id 就可以拿到动态ID
          path: 'console/:id/',  // 动态路由匹配 hippo/console/2/
          component: Console
        },
        { path: 'multi_exec/', component: MultiExec },
        { path: 'environment/', component: Environment },
        { path: 'release/', component: Release },
        { path: 'realease_apply/', component: ReleaseApply },
        { path: 'release_result/:id/', component: ReleaseResult },
        { path: 'schedule/', component: Schedule },
      ]
    },
    {
      path: '/host',
      component: Host
    },
  ]
})

